package com.gc.service;

import com.gc.util.EmailUtils;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;

@Service
@RefreshScope
public class EmailServiceImpl implements  EmailService {

    @Value("${config.email.host}")
    private String emailHost;


    @Override
    public  Boolean sendEmail(String email, String emailTitle, String message) {
        try {
            //这里邮箱地址和授权码暂时写死，安全性考虑没有放到配置文件中
            EmailUtils.sendEmail(emailHost, "m18323255858@163.com", "111", email, emailTitle, message);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }



}
